<template>
  <div>
    <!-- <el-menu
      :default-active="defaultActive"
      router
      class="el-menu-vertical-demo"
      background-color="#545c64"
      text-color="#fff"
      active-text-color="#ffd04b"
    >
      <el-submenu index="1">
        <template slot="title">
          <i class="el-icon-location"></i>
          <span>项目管理</span>
        </template>
        <el-menu-item index="projectList">项目列表</el-menu-item>
        <el-menu-item index="bannerList">banner列表</el-menu-item>
      </el-submenu>

      <el-submenu index="2">
        <template slot="title">
          <i class="el-icon-location"></i>
          <span>会员管理</span>
        </template>
        <el-menu-item index="person">个人</el-menu-item>
        <el-menu-item index="mech">机构</el-menu-item>
        <el-menu-item index="Uncertified">未认证用户</el-menu-item>
      </el-submenu>

      <el-submenu index="3">
        <template slot="title">
          <i class="el-icon-location"></i>
          <span>充值管理</span>
        </template>
        <el-menu-item index="chargeCoin">充币</el-menu-item>
        <el-menu-item index="carryCoin">提币</el-menu-item>
      </el-submenu>

      <el-submenu index="4">
        <template slot="title">
          <i class="el-icon-location"></i>
          <span>分红管理</span>
        </template>
        <el-menu-item index="equity">权益分配</el-menu-item>
      </el-submenu>

      <el-submenu index="5">
        <template slot="title">
          <i class="el-icon-location"></i>
          <span>系统管理</span>
        </template>
        <el-menu-item index="paraset">参数设置</el-menu-item>
        <el-menu-item index="logopt">操作日志</el-menu-item>
        <el-menu-item index="userManage">用户管理</el-menu-item>
        <el-menu-item index="roleManage">角色管理</el-menu-item>
      </el-submenu>
    </el-menu>-->
    <!-- v-show="item.show==1" -->
    <el-menu
      :default-active="defaultActive"
      class="el-menu-vertical-demo"
      background-color="#545c64"
      text-color="#fff"
      active-text-color="#ffd04b"
      router
    >
      <el-submenu :index="String(item.menuId)" v-for="(item,ind) in menuList" :key="ind">
        <template slot="title">
          <i class="el-icon-menu"></i>
          <span>{{item.menuName}}</span>
        </template>
        <el-menu-item :index="tag.permission" v-for="(tag,ind) in item.menuList" :key="ind">
          <i class="el-icon-location"></i>
          <span slot="title">{{tag.menuName}}</span>
        </el-menu-item>
      </el-submenu>
    </el-menu>
  </div>
</template>
<script>
export default {
  data() {
    return {
      account: "",
      password: "",
      menuList: []
    };
  },
  computed: {
    defaultActive: function() {
      return this.$route.path.replace("/", "");
    }
  },
  created() {
    this.account = sessionStorage.getItem("account");
    this.password = sessionStorage.getItem("password");
    this.Login();
  },
  methods: {
    // 登陆
    Login() {
      let url = "/user/login";
      let params = {
        name: this.account,
        pasword: this.password
      };
      this.httpPost(url, params, res => {
        if (res.code == 200) {
          //匹配页面
          this.menuList = res.data.menuList;
        }
      });
    }
  }
};
</script>

<style scoped>
</style>